#include "channel.hpp"
#include "processpool.hpp"
#include "task.hpp"

void Usage(std::string process)
{
    std::cerr << "Usage:" << process << "-num" << std::endl;
}

int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        return USAGEFAIL;
    }
    int num = std::stoi(argv[1]);
    processpool *pp = new processpool(num, worker);
    // 1.初始化进程池
    pp->InitProcessPool();
    // 2.派发任务
    pp->DispatchTask();
    // 3.清理进程池
    pp->CleanProcessPool();
    delete pp;
    return 0;
}